package com.sunday.common.sentinel.study.e3_Openfegin;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.PathVariable;

@FeignClient(name = "sunday-openfegin-provider",
        path = "/test",
        fallback = EchoServiceFallback.class,
        configuration = FeignConfiguration.class)
public interface EchoClient extends EchoApi {

}

class FeignConfiguration {
    @Bean
    public EchoServiceFallback echoServiceFallback() {
        return new EchoServiceFallback();
    }
}

class EchoServiceFallback implements EchoClient {
    @Override
    public String echo(@PathVariable("str") String str) {
        return "echo fallback";
    }
}